package o;

import android.content.Context;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import o.bqf.b;

public class bow implements bpm {
    private String ʻ;
    private String ˊ;
    private final bpz ˋ;
    private int ˎ;
    private bqf ˏ;
    private final Context ॱ;

    public bow(Context context, bpz o_bpz) {
        this.ॱ = context;
        this.ˋ = o_bpz;
    }

    public void ˋ(boolean z) {
        if (z) {
            ˋ();
        } else {
            this.ˋ.ॱ(5, "Not signed the agreement.");
        }
    }

    public void ˎ(@NonNull String str, @NonNull bqf o_bqf) {
        boc.ˎ.ˋ("DeferredUninstallHandler", "deferredUninstall, pkgName: " + str + ", modules: " + o_bqf);
        this.ˊ = str;
        this.ˏ = o_bqf;
        this.ˎ = bla.ॱ(this.ॱ, this.ˊ);
        this.ʻ = new bpb().ˏ(this.ˊ).ॱ(this.ˎ).ˊ(this.ˏ).ˏ(30).ˏ();
        if (!ccx.ॱ()) {
            boc.ˎ.ˏ("DeferredUninstallHandler", "Require to sign the agreement.");
            bpp.ˏ().ˏ(this);
            new bpq(this.ॱ, this.ˊ).ˎ();
        } else if (!ˊ()) {
            ˋ();
        }
    }

    private boolean ˊ() {
        bol ˊ = bor.ˎ().ˊ(this.ʻ);
        if (ˊ == null) {
            return false;
        }
        boc.ˎ.ˋ("DeferredUninstallHandler", "Session already exists.");
        this.ˋ.ˏ(ˊ.ˏ());
        return true;
    }

    private void ˋ() {
        if (TextUtils.isEmpty(this.ˊ) || this.ˏ == null || this.ˏ.ˋ().isEmpty()) {
            boc.ˎ.ˊ("DeferredUninstallHandler", "Run to unreachable logic.");
        } else if (!ˊ()) {
            bpd o_bpd = new bpd();
            o_bpd.ˋ(this.ˊ);
            o_bpd.ˏ(bla.ॱ(this.ॱ, this.ˊ));
            String[] ˏ = bla.ˏ(this.ॱ, this.ˊ);
            for (b bVar : this.ˏ.ˋ()) {
                if ("feature".equals(bVar.ˎ())) {
                    o_bpd.ˏ(bVar.ˋ());
                    ॱ(o_bpd, bVar.ˋ(), ˏ);
                }
            }
            bol o_bol = new bol(this.ˊ, o_bpd);
            o_bol.ˊ(this.ʻ);
            bor.ˎ().ॱ(o_bol);
            this.ˋ.ˏ(o_bol.ˏ());
        }
    }

    private void ॱ(bpd o_bpd, String str, String[] strArr) {
        String str2 = str + ".config.";
        for (String str3 : strArr) {
            if (str3.startsWith(str2)) {
                o_bpd.ˏ(str3);
            }
        }
    }
}
